package com.xdwanj.util;

public class NumUtil {

    /**
     * 判断ASCII码值
     */
    public static boolean isNumber(String str) {

        int point = 0;
        for (int i = str.length(); --i >= 0; ) {
            int chr = str.charAt(i);
            if (chr < 48 || chr > 57) {
                if (chr != 46) {
                    return false;
                }
            }

            //让小数点只出现一次
            if (chr == 46) {
                point = point + 1;
                if (point == 2)
                    return false;
            }
        }
        return true;
    }

}
